<!-- 广告管理 -->
<div class="manageTitle">
	广告管理
</div>

<div class="content" ng-controller="advertisementManage">
	<div class="addBtn">
		<span class="title">广告类型</span>
		<div class="input-group m-b">
		    <div class="input-group-btn dropdown" dropdown="">
		        <button type="button" class="btn btn-default" dropdown-toggle="" aria-haspopup="true"
		        aria-expanded="false">
		            {{nowSearchKey.name}}
		            <span class="caret">
		            </span>
		        </button>
		        <ul class="dropdown-menu">
		            <li ng-repeat="item in searchKey" ng-click="selectSearchKey(item);">
		                <a href="javascript:;">
		                    {{item.name}}
		                </a>
		            </li>
		        </ul>
		    </div>
		</div>
		
		<a href="javascript:;" class="btnForClass" ng-click="addAdvertisement();">新增广告</a>
	</div>

	<div class="table">
		<table>
			<thead>
				<tr>
					<th>封面图</th>
					<th>类型</th>
					<th>ID或链接</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="item in adList">
					<td><img ng-src="{{item.img}}" class="coverImg"></td>
					<td>
						<span ng-if="item.type==1">链接地址</span>
						<span ng-if="item.type==2">课程模块</span>
						<span ng-if="item.type==3">试题模块</span>
					</td>
					<td>
						{{item.value}}
					</td>
					<td class="operation">
						<a href="javascript:;"><img src="../img/edit.png" class="edit" ng-click="editAdvertisement(item);"></a>
						<a href="javascript:;"><img src="../img/delete.png" ng-click="deleteAdvertisement(item);"></a>
					</td>
				</tr>
				<tr ng-if="noData">
					<td colspan="6"><img src="../img/noData.png" class="height"></td>
				</tr>
			</tbody>
		</table>

		<ul class="pagination"></ul>
	</div>
</div>

<!-- 新增广告 -->
<script type="text/ng-template" id="addAdvertisement.html">
	<form class="form-horizontal" enctype="multipart/form-data" method="post" action="Ad/addAd" id="addAdvertisement">
		<div class="sortAdd">
			<p class="clearfix infoCourse">
				<label>添加图片</label>
				<input type="file" class="addPicturesIcon" accept="images/*" id="advertisementIcon" name="cover_file">
				<img src="../img/cover.png" class="addPictures" id="showIcon">
			</p>

			<div class="clearfix selectDiv infoCourse">
				<label>选择类型</label>

				<div class="input-group m-b">
				    <div class="input-group-btn dropdown" dropdown="">
				        <button type="button" class="btn btn-default" dropdown-toggle="" aria-haspopup="true"
				        aria-expanded="false">
				            {{nowAdvertisementType.name}}
				            <input type="text" ng-model="nowAdvertisementType.id" name="type" class="advertisementType">
				            <input type="text" value="2" name="position" class="advertisementType">
				            <span class="caret"></span>
				        </button>
				        <ul class="dropdown-menu">
				            <li ng-repeat="item in advertisementTypeList" ng-click="selectAdvertisementType(item);">
				                <a href="javascript:;">
				                    {{item.name}}
				                </a>
				            </li>
				        </ul>
				    </div>
				</div>
			</div>

			<p class="clearfix infoCourse">
				<label>ID或链接</label>
				<input type="text" ng-model="value" name="value">
			</p>

			<a href="javascript:;" class="sure" ng-click="save();">保存</a>
			<a href="javascript:;" class="cancel" ng-click="cancelAdd();">取消</a>
		</div>
	</form>
</script>

<!-- 编辑广告 -->
<script type="text/ng-template" id="editAdvertisement.html">
	<form class="form-horizontal" enctype="multipart/form-data" method="post" action="Ad/editAd" id="editAdvertisement">
		<div class="sortAdd">
			<p class="clearfix infoCourse">
				<label>添加图片</label>
				<input type="file" class="addPicturesIcon" accept="images/*" id="advertisementIcon" name="cover_file">
				<img ng-src="{{editInfo.img}}" class="addPictures" id="showIcon">
			</p>

			<div class="clearfix selectDiv infoCourse">
				<label>选择类型</label>

				<div class="input-group m-b">
				    <div class="input-group-btn dropdown" dropdown="">
				        <button type="button" class="btn btn-default" dropdown-toggle="" aria-haspopup="true"
				        aria-expanded="false">
				            {{nowAdvertisementType.name}}
				            <input type="text" ng-model="nowAdvertisementType.id" name="type" class="advertisementType">
				            <input type="text" value="2" name="position" class="advertisementType">
				            <input type="text" ng-model="editInfo.id" name="id" class="advertisementType">
				            <span class="caret"></span>
				        </button>
				        <ul class="dropdown-menu">
				            <li ng-repeat="item in advertisementTypeList" ng-click="selectAdvertisementType(item);">
				                <a href="javascript:;">
				                    {{item.name}}
				                </a>
				            </li>
				        </ul>
				    </div>
				</div>
			</div>

			<p class="clearfix infoCourse">
				<label>ID或链接</label>
				<input type="text" ng-model="editInfo.value" name="value">
			</p>

			<a href="javascript:;" class="sure" ng-click="save();">保存</a>
			<a href="javascript:;" class="cancel" ng-click="cancelAdd();">取消</a>
		</div>
	</form>
</script>